<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>offer编辑</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <script src="../../js/commons.js"></script>
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-container">
    <div class="layui-row">
        <div class="layui-col-md9">
            <div class="layui-form layuimini-form">

                        <input type="hidden"  name="oid" id="oid" lay-verify="required"  value="" class="layui-input">

                <div class="layui-form-item">
                    <label class="layui-form-label required">请输入手机号</label>
                    <div class="layui-input-block">
                        <input type="number" name="username" id="phone" lay-verify="required" lay-reqtext="手机不能为空" placeholder="请输入手机" value="" class="layui-input">
                        <span id="phoneSpan"></span>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">邮箱</label>
                    <div class="layui-input-block">
                        <input type="email" id=email name="email" placeholder="请输入邮箱" value="" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">请输入失效时间</label>
                    <div class="layui-input-block">
                        <input type="text" id="validTime" name="validTime" placeholder="请输入失效时间" value="" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">请输入offer内容</label>
                    <div class="layui-input-block">
                        <textarea name="content" id="content" class="layui-textarea" placeholder="请输入offer内容"></textarea>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="saveBtn">确认保存</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            console.log("data==",data);
            layer.confirm('真的修改offer么', function (index) {
                $.ajax({
                    url: URL+"recruiter/offer/updateOffer",
                    headers: {"token":window.localStorage.getItem("token")},
                    data:data.field,
                    success:function (result){
                        if(result.code==0){
                            layer.msg("修改成功",function () {
                                //执行搜索重载
                                table.reload('currentTableId', {
                                    page: {
                                        curr: 1
                                    }
                                }, 'data');
                                layer.close(index);
                            });
                        }else {
                            layer.msg("修改失败");
                        }
                    }
                })

            });
            return false;
        });

    });
</script>
</body>
</html>